package com.example.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.Builder;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "rate_limit_config")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RateLimitConfig {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(name = "public_id")
    private Long publicId;

    @Column(name = "client_id", nullable = false, length = 64)
    private String clientId;

    @Column(name = "interface_name", nullable = false, length = 255)
    private String interfaceName;

    @Column(name = "limit_type", nullable = false)
    private Integer limitType; // 修改为 Integer 类型

    @Column(name = "permits_per_second", nullable = false, columnDefinition = "INT DEFAULT 100")
    private Integer permitsPerSecond;

    @Column(name = "permits_per_day", nullable = false, columnDefinition = "INT DEFAULT 1000000")
    private Integer permitsPerDay;

    @Column(name = "create_time")
    private LocalDateTime createTime;

    @Column(name = "update_time")
    private LocalDateTime updateTime;

    @Column(name = "enabled", nullable = false, columnDefinition = "TINYINT(1) DEFAULT 1")
    private Boolean enabled;
}
